#include "GetZigbeeParamCmd.h"

GetZigbeeParamCmd::GetZigbeeParamCmd(QObject *parent) :
    BaseCmd(parent)
{
    this->m_protocolType = ProtocolType::ZigbeeConfigProtocol;
    this->m_functionCode = FunctionCode;

    this->m_type = 0;
    this->m_channel = 0;
    this->m_power = 0;
}

Package GetZigbeeParamCmd::toPackage()
{
    Package package;
    package.setFunction(FunctionCode);
    return package;
}

void GetZigbeeParamCmd::unPackage(Package package)
{
    QByteArray body = package.body();
    quint16 Index = 0;

    m_type = body.mid(Index,1).toHex().toUInt(0,16);
    Index += 1;

    m_channel = body.mid(Index,1).toHex().toUInt(0,16);
    Index += 1;

    m_power = body.mid(Index,1).toHex().toUInt(0,16);
    Index += 1;

    m_address = body.mid(Index,2);
    Index += 2;

    m_panId = body.mid(Index,2);
    Index += 2;

    m_extPanId = body.mid(Index,8);
    Index += 8;

    m_nwkKey = body.mid(Index,16);
}
quint8 GetZigbeeParamCmd::type() const
{
    return m_type;
}

void GetZigbeeParamCmd::setType(const quint8 &type)
{
    m_type = type;
}
quint8 GetZigbeeParamCmd::channel() const
{
    return m_channel;
}

void GetZigbeeParamCmd::setChannel(const quint8 &channel)
{
    m_channel = channel;
}
quint8 GetZigbeeParamCmd::power() const
{
    return m_power;
}

void GetZigbeeParamCmd::setPower(const quint8 &power)
{
    m_power = power;
}
QByteArray GetZigbeeParamCmd::address() const
{
    return m_address;
}

void GetZigbeeParamCmd::setAddress(const QByteArray &address)
{
    m_address = address;
}
QByteArray GetZigbeeParamCmd::panId() const
{
    return m_panId;
}

void GetZigbeeParamCmd::setPanId(const QByteArray &panId)
{
    m_panId = panId;
}
QByteArray GetZigbeeParamCmd::extPanId() const
{
    return m_extPanId;
}

void GetZigbeeParamCmd::setExtPanId(const QByteArray &extPanId)
{
    m_extPanId = extPanId;
}
QByteArray GetZigbeeParamCmd::nwkKey() const
{
    return m_nwkKey;
}

void GetZigbeeParamCmd::setNwkKey(const QByteArray &nwkKey)
{
    m_nwkKey = nwkKey;
}







